package edu.neusoft.yiqibike.common.config;

import edu.neusoft.yiqibike.common.injection.LoginUserInjection;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

import java.util.List;

/**
 * User：lyc
 * Date：2017-10-15
 * Time：20:38
 * Description：注册自定义依赖注入模块
 */
@EnableWebMvc
@Configuration
public class WebMvcConfig extends BaseWebMvcConfig {
    @Bean
    public HandlerMethodArgumentResolver loginUserResolver() {
        return new LoginUserInjection();
    }

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        argumentResolvers.add(loginUserResolver());
        super.addArgumentResolvers(argumentResolvers);
    }
}
